package com.d0324;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class StringTest {
    public static void main(String[] args) {
     /*   String s="beijingETC";
        System.out.println(s.indexOf('i'));
        System.out.println(s.lastIndexOf('i'));
        System.out.println(s.indexOf('i',3));
        System.out.println(s.indexOf("jing"));
        System.out.println(s.indexOf("jing",4));
        System.out.println(s.charAt(2));*/
        /*int i=10;
        String s=String.valueOf(i);
        char[] c={'h','e','l','l','o'};
        String s1=String.valueOf(c);
        String s2=String.valueOf(c,1,4);
        System.out.println(s);
        System.out.println(s1);
        System.out.println(s2);*/
        /*String str="hello";
        String str1="hi.txt";
        System.out.println(str.substring(2));
        System.out.println(str.substring(1,4));
        System.out.println(str.compareTo(str1));
        System.out.println(str1.endsWith("txt"));
        System.out.println(str1.startsWith("h"));
        System.out.println(str1.trim());*/
       /* String regex="^((13[0-9])|(15[^4])|(18[0,2,3,5-9])|(17[0-8])|(147))\\d{8}$";
        Pattern pattern=Pattern.compile(regex);
        String num="13312412412";
        Matcher matcher= pattern.matcher(num);
        if(matcher.matches()){
            System.out.println("正确");
        }else {
            System.out.println("失败");
        }*/
       /*String num="13131313131";
        String regex="^((13[0-9])|(15[^4])|(18[0,2,3,5-9])|(17[0-8])|(147))\\d{8}$";
        boolean result=num.matches(regex);
        if (result){
            System.out.println("正确");
        }else {
            System.out.println("失败");
        }*/
       String str="jack,22,dalian";
       String str1=str.replaceAll(",","-");
        System.out.println(str1);


    }
}
